"""
Test Frame Requirements:

Sign In Page:
    "Sign In" window title
    Welcome Message
    Username label -> allows user text input
    Username entry
    Password label
    Password entry -> allows user text input
    Remember me radio button -> toggle on/off just for show
    Sign in button -> students go to Student Courses View, teachers go to Teacher Course View, proctors go to Proctor Student List View
        Sign in button is currently tripled for convenience to testing.

Proctor Student List View:
    "Student List" window title
    Proctor button list (Home, Search, current window)
    4 student identity frames (that act as buttons?) -> Proctor Student View
    broadcast chat box

#TODO:
Proctor Student View:
    "Student View" window title
    Proctor button list (Home, Search, current window)
    student name label
    test name label
    test info button -> Test Info View
    Time/Event table
    chat box
    picture of student
    confidence level canvas?
    note taking entry box
    add note button

#TODO:
Test Info View:
    "Test Info View" window title
    Proctor button list (Home, Search, current window)
    text box with info about the test

Teacher Course View:
    "Course List" window title
    Teacher button list (Home, Search, current window, Proctor Mode, Switch to Student List, Test Info)
    two courses as frames:
        Course name label
        Test/Number of Questions/Percent Completed/Average Mark table with scrollbar
    View Course button -> Teacher? Course View
    View Student List button -> Teacher Course Student List
    move up button
    move down button
    add new course button

Teacher Test View:
    "Course View" window title
    Teacher button list
    two midterms as frames:
        Midterm name label
        Section/Number of Questions/Percent Completed/Average Mark table with scrollbar
    View button -> Teacher TestInfo View?
    move up button
    move down button
    add new test button

#TODO:
Teacher TestEdit View:
    "Test View" window title
    teacher button list
    listbox for sections with questions in them with scrollbar
    Frames for test sections:
        midterm section label
        questions inside editable text boxes
        edit button inside frame
        up button inside frame
        down button inside frame
        View button outside frame
        move up button outisde frame
        move down button outisde frame
    add section button

#TODO:
Teacher Course Student List:
    "Student List" window title
    teacher button list
    listbox for student names
    frames for each student:
        student name label
        student number label
        student picture
        #incidents and course mark labels
        view details button
    add student to class button
    proctor list label
    list of proctor names
    add proctor button

#TODO:
Teacher Student View:
    "Student" window title
    teacher button list
    labels for student name, # incidents, student number, current grade
    picture of student
    frames for test sections:
        section name label
        date of completion label
        proctor view button
        mark button
        image of confidence sensor

#TODO:
Teacher TestInfo View:
    "Test Info" window title
    teacher button list
    editable text box for teacher to write test info

#TODO:
System Admin Students:
    "Test Info" window title
    sysadmin button list (Home, Search, window name, Switch to Proctor)
    course listbox
    new course button
    enlisted student listbox
    add button
    remove button
    student search box
    new student button

#TODO:
System Admin Proctors:
    "Test Info" window title
    sysadmin button list (Home, Search, window name, Switch to Students)
    course listbox
    new course button
    enlisted proctor listbox
    add button
    remove button
    proctor search box
    new proctor button

Student Courses View:
    "Course List" window title
    student button list (Home, Search, window name)
    two courses as frames:
        Course name label
        Test/Number of Questions/Test Due Date/Test Written Date/Mark table with scrollbar
    View Course button -> Student test view

Student Test View:
    "Course View" window title
    student button list
    two midterms as frames:
        Midterm name label
        Section/Number of Questions/Section Written Date/Mark table with scrollbar
    View Marks button -> Student Mark View
    Start Test button -> Student Test Taking View

Student Test Taking View:
    "Course View" window title
    student button list
    list of questions as listbox with scrollbar
    frames for questions in them:
        label with question name/description and radio buttons for choices
        label with question name/picture of a graph and a slider bar under it
    proctor chat box

Student Mark View:
    "Marks View" window title
    student button list
    list of questions as listbox with scrollbar
    frames for questions in them:
        label with question name/description and radio buttons for choices with a correct/incorrect choice highlighted and mark given
        label with question name/picture of a graph and a slider bar under it with a correct/incorrect choice highlighted and mark given
    proctor chat box

"""

import sys
import Tkinter as tk
import screenmanager
import Proctor
import Teacher
import Student
import Shared

def main():
    screenmanager.init()

    d = screenmanager.__dict__
    for i in Proctor.__all__:
        mod = Proctor.__dict__.get(i)
        mod.__dict__.update(dict(tk=tk,screenmanager=screenmanager,shared=Shared))
        if i in Proctor.views:
            d['switch_to_proctor_{0}'.format(i)] = lambda mod=mod: screenmanager.switch_frame(mod.create)
    for i in Student.__all__:
        mod = Student.__dict__.get(i)
        mod.__dict__.update(dict(tk=tk,screenmanager=screenmanager,shared=Shared))
        if i in Student.views:
            d['switch_to_student_{0}'.format(i)] = lambda mod=mod: screenmanager.switch_frame(mod.create)
    for i in Teacher.__all__:
        mod = Teacher.__dict__.get(i)
        mod.__dict__.update(dict(tk=tk,screenmanager=screenmanager,shared=Shared))
        if i in Teacher.views:
            d['switch_to_teacher_{0}'.format(i)] = lambda mod=mod: screenmanager.switch_frame(mod.create)
    for i in Shared.__all__:
        mod = Shared.__dict__.get(i)
        mod.__dict__.update(dict(tk=tk,screenmanager=screenmanager,shared=Shared))
        if i in Shared.views:
            d['switch_to_{0}'.format(i)] = lambda mod=mod: screenmanager.switch_frame(mod.create)

    screenmanager.switch_to_sign_in_view()
    screenmanager.run()

if __name__ == '__main__':
    main()
    sys.exit()
